package com.visizen.wisdomclass.server.client;

import com.visizen.wisdomclass.server.model.WcRight;
import com.visizen.wisdomclass.server.model.WcRightExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface WcRightMapper {
    @SelectProvider(type=WcRightSqlProvider.class, method="countByExample")
    int countByExample(WcRightExample example);

    @DeleteProvider(type=WcRightSqlProvider.class, method="deleteByExample")
    int deleteByExample(WcRightExample example);

    @Delete({
        "delete from wc_right",
        "where RIGHT_ID = #{RIGHT_ID,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long RIGHT_ID);

    @Insert({
        "insert into wc_right (RIGHT_ID, PARENT_ID, ",
        "NAME, DESCRIPTION)",
        "values (#{RIGHT_ID,jdbcType=BIGINT}, #{PARENT_ID,jdbcType=BIGINT}, ",
        "#{NAME,jdbcType=VARCHAR}, #{DESCRIPTION,jdbcType=VARCHAR})"
    })
    int insert(WcRight record);

    @InsertProvider(type=WcRightSqlProvider.class, method="insertSelective")
    int insertSelective(WcRight record);

    @SelectProvider(type=WcRightSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="RIGHT_ID", property="RIGHT_ID", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="PARENT_ID", property="PARENT_ID", jdbcType=JdbcType.BIGINT),
        @Result(column="NAME", property="NAME", jdbcType=JdbcType.VARCHAR),
        @Result(column="DESCRIPTION", property="DESCRIPTION", jdbcType=JdbcType.VARCHAR)
    })
    List<WcRight> selectByExample(WcRightExample example);

    @Select({
        "select",
        "RIGHT_ID, PARENT_ID, NAME, DESCRIPTION",
        "from wc_right",
        "where RIGHT_ID = #{RIGHT_ID,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="RIGHT_ID", property="RIGHT_ID", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="PARENT_ID", property="PARENT_ID", jdbcType=JdbcType.BIGINT),
        @Result(column="NAME", property="NAME", jdbcType=JdbcType.VARCHAR),
        @Result(column="DESCRIPTION", property="DESCRIPTION", jdbcType=JdbcType.VARCHAR)
    })
    WcRight selectByPrimaryKey(Long RIGHT_ID);

    @UpdateProvider(type=WcRightSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") WcRight record, @Param("example") WcRightExample example);

    @UpdateProvider(type=WcRightSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") WcRight record, @Param("example") WcRightExample example);

    @UpdateProvider(type=WcRightSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(WcRight record);

    @Update({
        "update wc_right",
        "set PARENT_ID = #{PARENT_ID,jdbcType=BIGINT},",
          "NAME = #{NAME,jdbcType=VARCHAR},",
          "DESCRIPTION = #{DESCRIPTION,jdbcType=VARCHAR}",
        "where RIGHT_ID = #{RIGHT_ID,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(WcRight record);
}